package org.jivesoftware.smack.util;

import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.Packet;

public final class SyncPacketSend
{
  public static Packet getReply(Connection paramConnection, Packet paramPacket, long paramLong)
    throws XMPPException
  {
    PacketIDFilter localPacketIDFilter = new PacketIDFilter(paramPacket.getPacketID());
    PacketCollector localPacketCollector = paramConnection.createPacketCollector(localPacketIDFilter);
    paramConnection.sendPacket(paramPacket);
    Packet localPacket = localPacketCollector.nextResult(paramLong);
    localPacketCollector.cancel();
    if (localPacket == null)
      throw new XMPPException("No response from server.");
    if (localPacket.getError() != null)
      throw new XMPPException(localPacket.getError());
    return localPacket;
  }

  public static Packet getReply(Connection paramConnection, Packet paramPacket)
    throws XMPPException
  {
    return getReply(paramConnection, paramPacket, SmackConfiguration.getPacketReplyTimeout());
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.util.SyncPacketSend
 * JD-Core Version:    0.6.1
 */